<?php
require(dirname(__FILE__)."/includes/init.php");

if (isset($_REQUEST['u']) && isset($_REQUEST['address'])) {
	$client = new client();
	$url = $_REQUEST['u'];
	$address = $_REQUEST['address'];	
	$addressId = $_REQUEST['addressId'];
	$type = $_REQUEST['type'];
	$templateId = isset($_REQUEST['templateId'])?$_REQUEST['templateId']:0;
	$url = base64_decode($url);

    $urlA = explode(".", $url);
    $urlA[0] = $clickJumpUrl;   //define jump url not with .COM
    foreach ($urlA as $key => $value) {
        $urls = $urls.$value.".";
    }
    $urls = trim($urls, ".");
    
	$url = addslashes($urls);
	$addressId = addslashes($addressId);
	$address = addslashes($address);
	$ip = $client->get_user_ip();
	$brownserLanguage = $client->get_user_lang();
	$sql = "insert into clickTrack(url, addressId, address, ip, type, timeStamps, templateId, brownserLanguage) values('".$urls."', '".$addressId."', '".$address."', '".$ip."', '".$type."', ".time().", ".$templateId.", '".$brownserLanguage."')";
	$GLOBALS['db']->dbquery($sql);
	$address = urlencode($address);
	sleep(1);
	$url = $urls."?".$address;
	header('Location:'.$url);	
}else{
	exit("don't try");
}


?>